import time
import unittest
import HTMLTestRunner_PY3

import app
from scipt.test_login import TestLogin
from scipt.test_emp import EmpTest
from scipt.test_dept import Department
from scipt.test_login_param import TestLoginPa
from scipt.test_emp_pa import EmpTestPara


def login():
    suite = unittest.TestSuite()

    suite.addTest(unittest.makeSuite(TestLogin))

    report_path = "./report/ihrm_login_test{}.html".format(time.strftime('%Y%m%d %H%M%S'))
    with open(report_path, mode="wb") as f:
        runner = HTMLTestRunner_PY3.HTMLTestRunner(f)
        runner.run(suite)


def emp_test():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(EmpTest))
    report_path = "./report/ihrm_emp_test{}.html".format(time.strftime('%Y%m%d %H%M%S'))
    with open(report_path, mode="wb") as f:
        runner = HTMLTestRunner_PY3.HTMLTestRunner(f)
        runner.run(suite)


def dept_test():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(Department))
    report_path = "./report/ihrm_dept_test{}.html".format(time.strftime('%Y%m%d %H%M%S'))
    with open(report_path, mode="wb") as f:
        runner = HTMLTestRunner_PY3.HTMLTestRunner(f)
        runner.run(suite)


def login_param_test():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TestLoginPa))
    suite.addTest(unittest.makeSuite(EmpTestPara))
    report_path = app.BASE_dir + "/report/ihrm_login_test_pa{}.html".format(time.strftime('%Y%m%d %H%M%S'))
    with open(report_path, mode="wb") as f:
        runner = HTMLTestRunner_PY3.HTMLTestRunner(f)
        runner.run(suite)


login_param_test()


print("测试改变run_suite.py代码之后，触发的轮巡构建，符号标志：100个横线‘-’","-"*100)